<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	
	<link type="text/css" rel="stylesheet" href="#{request.contextPath}/resources/css/login.css" />  
	
	<h:panelGroup id="panelGroup_login" styleClass="panelGroupLogin" layout="block" rendered="#{mainBean.loginState}">


		<p:fieldset id="fieldSet_login" legend="#{msg.login_title}"	styleClass="fieldSetLogin">

			<h:form id="form_login" styleClass="form_login">
			
			<p:growl id="growl_login" globalOnly="false" autoUpdate="false" />

			<h:panelGrid id="panelGrid_login" columns="2">

				<h:outputText id="outputText_login" value="#{msg.label_login}:" />
				<p:inputText id="inputText_login"
					value="#{mainBean.userToLogin.login}" required="true"	requiredMessage="#{msg.required_field_login}" />
				<h:outputText id="outputText_password"	value="#{msg.label_password}:" />
				<p:password id="password_login" value="#{mainBean.userToLogin.pass}" required="true" requiredMessage="#{msg.required_field_password}" />
				<p:commandLink id="commandLink_createAccount" action="#{mainBean.prepareToCreateAccount}" ajax="false" value="#{msg.create_account}" 
					process="@this" immediate="true"/>
				<p:commandButton id="commandbutton_login" value="#{msg.login}" styleClass="loginButton" ajax="false" action="#{mainBean.login}"
					process="@form" />

			</h:panelGrid>
				
			</h:form>
				
		</p:fieldset>
	
	</h:panelGroup>
	<h:panelGroup id="panelGroup_createAccount" styleClass="panelGroup_createAccount" layout="block" rendered="#{mainBean.createAccountState}">
		<h:form id="form_createAccount" styleClass="form_createAccount">
			<p:growl id="input_growl" globalOnly="true" for="inputText_create_login" />
			
			<p:fieldset id="fieldset_createAccount" legend="#{msg.create_account}" styleClass="fieldset_createAccount" >
				
				<h:panelGrid id="panelGrid_create_account" columns="3" styleClass="panelGrid_create_account">
					
					<h:outputText id="outputText_create_login" value="#{msg.label_email} / #{msg.label_login}"/>
					<p:inputText id="inputText_create_login" value="#{mainBean.userToLogin.login}" required="true" requiredMessage="#{msg.required_field_login}"
						onblur="emailValidator(this, document.getElementById('form_createAccount:message_for_inputText_create_login'),'#{msg.invalid_email}');" />
					<p:message id="message_for_inputText_create_login"  for="inputText_create_login" display="text" />
					
					<h:outputText id="outputText_password"	value="#{msg.label_password}:" />
					<p:password id="password_create_account" value="#{mainBean.userToLogin.pass}" required="true" requiredMessage="#{msg.required_field_password}" 
						match="password_create_account_confirm" validatorMessage="#{msg.password_does_not_match}" />
					<p:message id="message_for_password_create_account"  for="password_create_account" display="text"/>
					
					<h:outputText id="outputText_password_confirm"	value="#{msg.label_password_confirm}:" />
					<p:password id="password_create_account_confirm" value="#{mainBean.userToLogin.pass}" required="true" requiredMessage="#{msg.required_field_password_confirm}" />
					<p:message id="message_for_password_create_account_confirm"  for="password_create_account_confirm" display="text"/>

				</h:panelGrid>
							
				<h:panelGrid id="panelGrid_create_account_buttons" columns="3" styleClass="panelGrid_create_account_buttons">
					<p:captcha id="captcha_create_account" label="Captcha" language="tr" theme="white" validatorMessage="#{msg.invalid_captcha}" 
						required="true" requiredMessage="#{msg.captcha_required}" />
					<p:message id="message_for_captcha_create_account" for="captcha_create_account" display="text" />
					<h:panelGroup id="panelGroup_random1" />
					<h:panelGroup  id="panelGroup_create_account_buttons" >	
					<p:commandButton id="commandbutton_create_account" value="#{msg.create_account}" styleClass="commandbutton_create_account" 
							action="#{mainBean.createAccount}"	process="@form" ajax="false" />
					<p:commandButton id="commandbutton_cancel" value="#{msg.label_cancel}" action="#{mainBean.cancelAccountCreate}" update=":panelGroup_center" 
							process="@this"/>
					</h:panelGroup>
					<h:panelGroup id="panelGroup_random2"/>	
					<h:panelGroup id="panelGroup_random3"/>
				</h:panelGrid>
				
			</p:fieldset>
		
		</h:form>
		
	</h:panelGroup>
</html>